import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Lily
 * Date: 2024-11-04
 * Time: 20:27
 */

public class test_1 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long b_akt = in.nextLong();
        long b_hp = in.nextInt();
        long w_akt = in.nextInt();
        long w_hp = in.nextInt();

        long ret = 0;
        while (b_hp > 0 && w_hp > 0) {
            ret += b_akt + w_akt;
            b_hp -= w_akt;
            w_hp -= b_akt;
        }

        if (b_hp <= 0 && w_hp > 0) {
            ret += w_akt * 10;
        } else if (b_hp >= 0 && w_hp < 0) {
            ret += b_akt * 10;
        }
        System.out.println(ret);
    }
}
